using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using MvcShop.Extensions;
using MvcShop.Core.Architecture.Cache;

namespace MvcShop.MVC.Areas.Admin.Controllers
{
    public class CacheManageController : Controller
    {
        //
        // GET: /CacheManage/
        private IMsCache _msCache;

        public CacheManageController(IMsCache msCache)
        {
            this._msCache = msCache;
        }

        public ActionResult ManageCache()
        {
            return View();
        }

        public ActionResult SetCache(string name)
        {

            return this.RedirectToAction(c => c.ManageCache());
        }

        public ActionResult DelCache(string name)
        {
            this._msCache.Remove(name);
            return this.RedirectToAction(c => c.ManageCache());
        }

        public ActionResult ClearCache()
        {
            this._msCache.Clear();
            return this.RedirectToAction(c => c.ManageCache());
        }
    }
}
